SET CGO_ENABLED=0
SET GOOS=linux
SET GOARCH=arm64

echo %1%
if "%1%"=="arm" (SET GOARCH=arm64)
if "%1%"=="arm32" (SET GOARCH=arm) 

echo -------------------------------------------
echo %GOARCH%
echo -------------------------------------------

rmdir /s/q linux\\edge
mkdir linux 
mkdir linux\\edge
mkdir linux\\edge\\bin

copy .\\*.sh linux\\edge\\bin\\
cd TM/edge/gosrc
go mod tidy
go build -tags edge -o ../../../linux\\edge\\bin/etm
cd ../../../



cd DM/edge/gosrc
go mod tidy
go build -tags edge -o ../../../linux\\edge\\bin/edm
cd ../../../



cd DEVS/onvif/gosrc
go mod tidy
go build -tags edge -o ../../../linux\\edge\\bin/eonvif
cd ../../../

cd DEVS/mm/gosrc
go mod tidy
go build -tags edge -o ../../../linux/edge\\bin/emm
cd ../../../

cd DEVS/modbus/gosrc
go mod tidy
go build -tags edge -o ../../../linux/edge\\bin/emodbus
cd ../../../

cd DEVS/magical/gosrc
go mod tidy
go build -tags edge -o ../../../linux/edge\\bin/emagical
cd ../../../

cd DEVS/serial_port/gosrc
go mod tidy
go build -tags edge -o ../../../linux/edge\\bin/eserial_port
cd ../../../

cd DEVS/dtu/gosrc
go mod tidy
go build -tags edge -o ../../../linux/edge\\bin/edtu
cd ../../../

cd Business/authedge/gosrc
go mod tidy
go build -tags edge -o ../../../linux\\edge\\bin/ebusiness
cd ../../../

cd TUNNEL/edge/gosrc
go mod tidy
go build -tags edge -o ../../../linux/edge/bin/etunnel
cd ../../../

cd TM/cfgpage
echo "-----------------------------------1--------"
call yarn
call yarn build-edge --dest ..\\..\\linux\\edge\\bin\\dist
echo "------------------------------------2-------"
cd ../../

xcopy defaultdb linux\edge\bin\defaultdb\ /s/y

set date=%date:~0,4%%date:~5,2%%date:~8,2%
echo build.64.%date%-%time% > linux\\edge\\bin\\ver

cd linux\\edge\\bin\\
tar -cvzf ../edge.64.all.tar.gz *
cd ../../../


